import { createApp } from 'vue'
import { bus } from '@beshell/events-ts/bus'
import App from './App.vue'
import {ObserveVisibility} from 'vue-observe-visibility'
const os = require('os');

// import 'swiper/css'
import './base/pad'

const app = createApp(App)
app.config.globalProperties.runtime = runtime
app.config.globalProperties.bus = bus
app.config.globalProperties.log = console.log

import naive from 'naive-ui'
app.use(naive)

bus._eventFilters?.push(

    "#EVENT.ADD#" ,
    "#EVENT.REMOVE#" ,

    "fstree.refresh()",

    "terminal.popdown()",
    "terminal.popup()",
    "terminal.echo()",
    "terminal.echo.error()",

    "wifisetting.popup()",
    
    "app.new",

    "spin-fullpage.show()" ,
    "spin-fullpage.hide()" ,
    "spin-fullpage.message()" ,

    "workspace.load()" ,   // arg: AppModel
    "workspace.open()" ,    // arg: string
    "workspace.close()" ,

    "firmware.popdown()",
    "firmware.popup()",
    "factory.popdown()",
    "factory.popup()",

    "topview.enter()",

    "projection.start()" ,
    "projection.stop()" ,
)

import vClickOutside from "click-outside-vue3"
app.use(vClickOutside)
app.directive('observe-visibility', ObserveVisibility)

app.mount('#app')

;(window as any).bus = bus
;(window as any).os = os